<?php
	class loginControl extends Control{

		function index(){
			if($this->rbac_is_login()){
				go("index/index");
			}
			$this -> display();
		}

		function show_code(){
			$check = new code();
			$check->show();
		}

		function checked(){
			$db = M("user");
			$session = $_SESSION["code"];
			if(strtoupper($session) != strtoupper($_POST["check"])){
				$this -> error ("验证码错误！","index");
			}
			if(!$this->rbac_user_login($_POST['username'],md5($_POST['password']),'admin')){
				$this->error($this->error,"index");
			}			
			$style = $db ->field("adminstyle")->find($_SESSION["user"]);
			$_SESSION["adminstyle"] = $style;
			go("index/index");
		}

		function quit(){
			$this->session_delall();
			$this->session_destroy();
			go("index");
		}

		function exitd(){
			$this -> session_delall();
			$this->session_destroy();
			go("index");
		}
	}
?>